package cn.learn.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author huangyezhan
 * @version 1.0
 * @date 2020年03月31日10:33
 */
@RestController
@RequestMapping("nacos/config")
@RefreshScope
public class NacosDemoController {

    @Value("${server.port}")
    private String port;

    @Value("${config.myPort}")
    private String myPort;

    @RequestMapping(value = "port", method = RequestMethod.GET)
    public Map cancelOrder() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("端口", port);
        map.put("my", myPort);
        return map;
    }

}
